/*
 * @lc app=leetcode.cn id=441 lang=typescript
 *
 * [441] 排列硬币
 */

// @lc code=start
function arrangeCoins(n: number): number {
    let now = 0;
    let count = 0;
    while (count < n) {
        now++;
        count += now;
    }
    return count === n ? now : now - 1;
}
// @lc code=end
